package com.ldz.eb.service;

import com.baomidou.mybatisplus.core.assist.ISqlRunner;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.ldz.eb.mapper.EbNewsMapper;
import com.ldz.eb.mapper.EbProductMapper;
import com.ldz.eb.module.EbNews;
import com.ldz.eb.module.EbProduct;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.Collection;
import java.util.HashMap;
import java.util.Map;
import java.util.Set;

@Service
public class IndexService {
    @Resource
    private EbProductMapper ebPM;
    @Resource
    private EbNewsMapper ebNM;
    public  Map<String, Page> index(int p, int ps){
        Map<String,Page> goal = new HashMap<>();

        Page page = new Page(p,ps);
        Page proPage= ebPM.selectPage(page,null);
        goal.put("proPage",proPage);
        Page pageN= new Page(1,8);
        Page newsPage=ebNM.selectPage(pageN,new QueryWrapper<EbNews>().orderByDesc("en_create_time"));
        goal.put("newsPage",newsPage);
        return goal;
    }
}
